package com.qfedu.food.controller;

import com.qfedu.food.dto.TUserDto;
import com.qfedu.food.service.intf.TUserService;
import com.qfedu.food.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/tuser/")
@Api(tags = "实现User各种操作")
public class TUserController {
    @Autowired
    private TUserService service;

    @ApiOperation(value = "实现新增", notes = "实现新增")
    @PostMapping("save.do")
    public R save(@RequestBody TUserDto dto){
        return service.register(dto);
    }

    @ApiOperation(value = "实现全部查询", notes = "实现全部查询")
    @GetMapping("all.do")
    public R all(){
        return service.queryAll();
    }

    @ApiOperation(value = "完成登录", notes = "完成登录")
    @PostMapping("login.do")
    public R login(@RequestBody TUserDto dto){
        return service.login(dto);
    }
}
